from django.conf.urls import url
from rest_framework_jwt.views import obtain_jwt_token

from users.views import UserCenterInfoAPIView, EmailUpdateAPIView, VerificationEmailView
# from users.views import EmailUpdateAPIView
from . import views

urlpatterns = [
    url(r'^usernames/(?P<username>\w{5,20})/count/$',views.RegisterUsernameCountAPIView.as_view()),
    url(r'^phones/(?P<mobile>1[3-9]\d{9})/count/$',views.RegisterPhoneCountAPIView.as_view()),
    url(r'^$',views.RegisterCreateView.as_view()),
    # url(r'^auths/',obtain_jwt_token,name='auths'),
    url(r'^auths/$',views.UserAuthorizationView.as_view()),
    url(r'^infos/$',UserCenterInfoAPIView.as_view(),name='detail'),
    url(r'^emails/$',EmailUpdateAPIView.as_view(),name='send_mail'),
    url(r'^emails/verification/$',VerificationEmailView.as_view(),name='email_result'),
    # url(r'^addresses/$', views.AddressesCreateAPIView.as_view()),
    # /users/browerhistories/
    url(r'browerhistories/$',views.UserHistoryAPIView.as_view())

]

from .views import AddressViewSet
from rest_framework.routers import DefaultRouter
router = DefaultRouter()
router.register(r'addresses',AddressViewSet,base_name='address')
urlpatterns += router.urls
